var fruits = [
    {

        fruitName: '苹果',

        fruitQuantity: 30,

        fruitPrice: 3.8

    },
    {

        fruitName: '西瓜',

        fruitQuantity: 240,

        fruitPrice: 1.8

    },
    {

        fruitName: '芒果',

        fruitQuantity: 60,

        fruitPrice: 7.8
    }
]
// 显示所有的水果名称
for(let i=0;i<fruits.length;i++){
    console.log(fruits[i].fruitName);
}

// 显示所有水果项的名称与单价
for(let i in fruits){
     console.log(fruits[i].fruitQuantity);
     console.log(fruits[i].fruitPrice);
}

// 显示所有水果项的小计（数据*单价）
for(let i of fruits){
    console.log(i.fruitPrice*i.fruitQuantity);
}

let total=0;
fruits.forEach((item)=>total+=item.fruitQuantity)
console.log(total);

arr=fruits.map((item)=>item.fruitQuantity=item.fruitQuantity+5)
for(let i of fruits){
    console.log(i);
}